package com.zjb;

import com.zjb.service.impl.ThreadProcessPasswordCrackServiceImpl;

import java.util.Arrays;
import java.util.List;

/**
 * @Author zhaojianbo
 * @Date 2022/10/18 16:57
 * @Description 破解excel
 */
public class Application {
    public static void main(String[] args) {
        String filePath = "C:\\Users\\Admin\\Desktop\\test.xlsx";
        String fileType = "XLSX";
        String savePassFilePath = "C:\\Users\\Admin\\Desktop\\pass.txt";
        List<Integer> passwdLenList = Arrays.asList(2, 3);
        long start = System.currentTimeMillis();
        boolean result = false;
        for (Integer passwdLen : passwdLenList) {
            ThreadProcessPasswordCrackServiceImpl crackService = new ThreadProcessPasswordCrackServiceImpl(filePath, fileType, savePassFilePath);
            result = crackService.run(passwdLen);
            if (result) {
                break;
            }
        }
        long end = System.currentTimeMillis();
        System.out.println("破解结束，破解用时：" + (end - start) + "  破解结果：" + (result ? "成功" : "失败") );
    }
}
